package com.itheima.day02static;

/*
* 5、【编号：1006】分析事物的共性，并抽取出正确的
* 继承体系 现有基础班老师（BaseTeacher）和就业班老
* 师（WorkTeacher）两个类，两者都含有姓名和年龄两
* 个属性，还有一个讲课的行为teach，但不同的是，基
* 础班老师的teach方法输出【基础班老师讲JavaSE】，
* 就业班老师的teach方法输出【就业班老师讲JavaEE】
* ，请用代码实现。 运行结果：
张三老师...23
基础班老师讲JavaSE
李四老师...24
就业班老师讲JavaEE
* */
public class Demo5 {
    public static void main(String[] args) {
        Teacher bt = new BaseTeacher("张三", 23);
        bt.show();
        bt.teach();
        Teacher wt = new WorkTeacher("李四", 24);
        wt.show();
        wt.teach();
    }
}

abstract class Teacher {
    private String name;
    private int age;

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public int getAge() {
        return age;
    }

    public void setAge(int age) {
        this.age = age;
    }

    public Teacher(String name, int age) {
        this.name = name;
        this.age = age;
    }

    public Teacher() {
    }

    public abstract void teach();

    public abstract void show();
}

class BaseTeacher extends Teacher {
    public BaseTeacher(String name, int age) {
        super(name, age);
    }

    public BaseTeacher() {
    }

    @Override
    public void teach() {
        System.out.println("【基础班老师讲JavaSE】");
    }

    @Override
    public void show() {
        System.out.println(getName() + "老师...." + getAge());
    }
}

class WorkTeacher extends Teacher {
    public WorkTeacher(String name, int age) {
        super(name, age);
    }

    public WorkTeacher() {
    }

    @Override
    public void teach() {
        System.out.println("【就业班老师讲JavaEE】");
    }

    @Override
    public void show() {
        System.out.println(getName() + "老师...." + getAge());
    }
}
